package day17;

/**
 * 打印机
 */
public class Printer {
    //打印机里有什么
    //纸  A4  A8
    private Paper paper;
    //墨盒 黑色墨盒，才是彩色墨盒
    private InkBox inkBox;

    public Printer(Paper paper, InkBox inkBox) {
        this.paper = paper;
        this.inkBox = inkBox;
    }
    //我是中国人
    public void print(String content){
        for(int i=0;i<content.length();i++){
           char cha=   content.charAt(i);
           if(i!=0&&i%this.paper.getSize()==0){
               System.out.println();
           }
           this.inkBox.getColor().print(cha);
            try {
                Thread.sleep(500);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
